 <form id="rolesform" action="index.php?ctl=roles&act=edit&p[0]=<{$roles.role_id}>" method="POST">
        <div style="text-align:right;padding:3px 18px"><{help docid="101" type="link"}><{t}>点击查看帮助<{/t}><{/help}></div>
        <input type="hidden" name="role_id" value="<{$roles.role_id}>" />
        <div class="division">
                <h4><{t}>角色名称<{/t}></h4>

           <input type="text" vtype="required" name="role_name" value="<{$roles.role_name}>" class="x-input " autocomplete="off">
       </div>
              <div class='division'>
          <h4><{t}>角色权限<{/t}></h4>
         <input type='hidden'  vtype='requiredcheckbox'/>
<{$menus1}><!-- 桌面挂件权限 -->

<{$menus2}><!-- 控制面板权限 -->

<div>
<input class='parent'<{if $checked_all}> checked="checked"<{/if}> type="checkbox">全选(业务权限)
<{foreach from=$menus3 item=value}>
<{$value}>
<{/foreach}>
</div>
</div>
</form>

<{area inject=".mainFoot"}>
        <div class="table-action">
                   <{button label=$___desktop="确定"|t:'desktop' id="rolesform-submit" class="btn-primary"}>
       </div>
<{/area}>
<script>
function nameCheck(input){
    id = input.value;
    role_id = $('roleID').value;
    if((input.checked)){
        new Request.HTML({
        url:'index.php?app=desktop&ctl=roles&act=get_permission',method:'post',
        update:$(input).getNext(),data:'role_id='+role_id+'&name='+encodeURIComponent(input.value=input.value.trim())}).send();
        $('workground'+id).setStyle('display','block');
    }
    else{
        $('workground'+id).setStyle('display','none').empty();;
    }

}

</script>
<script>
(function(){
    var _form = $('rolesform');
    var btn =$('rolesform-submit');
    var finder = finderGroup['<{$env.get.finder_id}>'];

    _form.store('target',{
        onComplete:function(){
            try{
                var _dialogIns = btn.getParent('.dialog').retrieve('instance');
             }catch(e){}
            if(_dialogIns){
                _dialogIns.close();
                finder.refresh.delay(400,finder);
            }


        }

    });

        btn.addEvent('click',function(){

            _form.fireEvent('submit',{stop:$empty});



        });


    _form.getElements('input.parent').addEvent('change',function(e){
        this.getParent().getElements('ul li input[type=checkbox]').set('checked',this.checked);
    });
    (function(){
        _form.getElements('input[checked]').each(function(el){
            if(!el.checked)el.set('checked', true);
        });
    }).delay(0);
})();



</script>